<extend name="Public/base"/>

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>[{$model['title']}] 列表</h2>
	</div>
	<div class="cf">
		<div class="fl">
			<empty name="model.extend">
				<div class="tools">
					<php> $add_url = U('add',array('uid'=>$_GET['uid']));</php>
					<a class="btn" href="{$add_url}">新 增</a>
					<php> $del_url = U('del',array('uid'=>$_GET['uid']));</php>
					<button class="btn ajax-post confirm" target-form="ids" url="{$del_url}">删 除</button>
					<a class="btn" href="{:U('Admin/User/index')}">返回用户管理</a>
				</div>
			</empty>
		</div>

	</div>


	<!-- 数据列表 -->
	<div class="data-table">
		<div class="data-table table-striped">
			<table>
				<!-- 表头 -->
				<thead>
				<tr>
					<if condition="$check_all">
						<th class="row-selected row-selected">
							<input class="check-all" type="checkbox">
						</th>
					</if>
					<volist name="list_grids" id="field">
						<th
						<notempty name="field.width">width="{$field.width}%"</notempty>
						>{$field.title}</th>
					</volist>
				</tr>
				</thead>

				<!-- 列表 -->
				<tbody>
				<volist name="list_data" id="data">
					<tr>
						<if condition="$check_all">
							<td><input class="ids regular-checkbox" type="checkbox" value="{$data['id']}" name="ids[]"
							           id="check_{$data['id']}"><label for="check_{$data['id']}"></label></td>
						</if>
						<volist name="list_grids" id="grid">
							<td>{:get_list_field($data,$grid,$model)}</td>
						</volist>
					</tr>
				</volist>
				</tbody>
			</table>
		</div>
	</div>
	<div class="page">
		{$_page|default=''}
	</div>
</block>

<block name="script">
	<script type="text/javascript">
		$(function () {
			//搜索功能
			$("#search").click(function () {
				var url = $(this).attr('url');
				var query = $('.search-form').find('input').serialize();
				query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
				query = query.replace(/^&/g, '');
				if (url.indexOf('?') > 0) {
					url += '&' + query;
				} else {
					url += '?' + query;
				}
				window.location.href = url;
			});

			//回车自动提交
			$('.search-form').find('input').keyup(function (event) {
				if (event.keyCode === 13) {
					$("#search").click();
				}
			});

		})
	</script>
</block>
